A method for optimized code debugging and especially a method for handling execution management of optimized code and for setting breakpoints in an optimized flow graph, for allowing an execution of an optimized code until a breakpoint is reached.
A debugger is a software tool that enables a user to analyze and probe another computer program, the other computer program is referred to as the debugged computer program. A common method to analyze and probe the debugged computer program involves the execution of portions or steps of the debugged computer program. Usually, a user can execute a single instruction or statement and check various variables or other indications that can help the user to debug the debugged computer program.
There is a growing need to enhance the efficiency of software execution. One method for achieving said goal is to receive a source code and to compile it in a manner that provides an optimized object code. A compiler compiles the source code in a manner that best fits the hardware that is supposed to execute the object code. Such an optimization is vital when the software is to executed by parallel processors, but is also of great significant in other cases.
A premium is placed upon optimizing computer programs that are written in high level languages such as C++ and C. Writing computer program in these languages is easier than writing computer programs in low level languages such a assembler. Furthermore, a single software program written in high level language can be easily compiled to a plurality of low level language computer programs, to fit a plurality of processors. The efficiency of non-optimized object code that is generated by a non-optimizing compiler from a computer program that is written in a high level language is considerably worse than that of the corresponding assembly language code. Therefore, there is a need to optimize the object code.
The optimization process can largely complicate the relationship between the source code and the object code, so that the debugging of optimized code is very complex. The complexity can be attributed to various factors. A major factor is that during the optimization process statements are executed out of order and instructions are interleaved, i.e., a code can be moved out of sequence so that part of a statement, or a complete statement, is moved in relation to other statements causing that variables are assigned their values out of order. The optimization generated two major mapping problems: (a) which sequence of source statements should be reported when stepping through the optimized machine code. (b) Which machine code addresses should breakpoints be set at when stepping through the source code.
A thorough review of prior art optimized code debuggers can be found at the following article: R. F. Brender, J. E. Nelson and M. E. Arsenault xe2x80x9cDebugging Optimized Code: Concepts and Implementation on DIGITAL Alpha Systems,xe2x80x9d Digital Technical Journal, Dec. 10, 1998xe2x80x9d. As seen from this article prior art methods of execution management of optimized code were very limited.
There is a need to provide a method for allowing an efficient execution management of optimized code. There is a further need to provide an improved method for allowing the execution management of optimized code that is not tailored to a certain optimization process.